package com.xxxx.controller;

import com.xxxx.pojo.Product;
import com.xxxx.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/product")
public class ProductController {

	@Autowired
	private ProductService productService;

	@GetMapping("/list")
	public List<Product> selectPro(){
		return productService.selectPro();
	};

	@GetMapping("/{id}")
	public Product selectById(@PathVariable("id") Integer id){
		return productService.selectById(id);
	}

	@PostMapping("/save")
	public Map<Object,Object> createP(@RequestBody Product product){
		return productService.createP(product);
	}
}
